package net.jxvtc.eshop.web.servlet.client;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import net.jxvtc.eshop.domain.Product;
import net.jxvtc.eshop.domain.ProductPageBean;
import net.jxvtc.eshop.domain.User;
@WebServlet("/demo")
public class DemoServlet extends HttpServlet {
	
	
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	List<Product> ps=new ArrayList<Product>();
	ProductPageBean bean=
			new ProductPageBean(100,10,ps);
	bean.setCategory("haa");
	
	String strPage=req.getParameter("page");
	int currentPage=1;
	if(strPage!=null&&!strPage.equals(""))
	{
		currentPage=Integer.parseInt(strPage);
	}
	bean.setCurrentPage(currentPage);
	bean.setTotalCount(100);
	
	
	req.setAttribute("bean", bean);
	req.setAttribute("url", req.getContextPath()+"/demo");
	req.getRequestDispatcher("/pageTest.jsp")
	.forward(req, resp);
}
}
